package com.nervenets.web.hibernate.domain;

import com.nervenets.web.enumeration.CheckStatus;
import com.nervenets.web.hibernate.DomainObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Building extends DomainObject {
    private String name;//楼盘名称
    private String cover;
    private boolean dating;
    private long sincer;
    private int sincerStartTime;//诚意金缴纳开始时间
    private int sincerEndTime;//诚意金缴纳结束时间
    private int sincerThawTime;//诚意金缴纳解冻时间
    @Type(type = "com.nervenets.web.adapter.jsonType.StringArrayJson")
    @Column(columnDefinition = "text")
    private List<String> tags = new ArrayList<>();
    @Column(columnDefinition = "text")
    private String description;
    private String price;
    private String totalPrice;
    private String area;
    private String type;
    private String houseTypeText;
    @Type(type = "com.nervenets.web.adapter.jsonType.HouseTypeArrayJson")
    @Column(columnDefinition = "text")
    private List<HouseType> houseTypes = new ArrayList<>();
    private String structure;
    private int openTime;
    private String address;
    private double longitude = 0;
    private double latitude = 0;
    private String saleAddress;
    private double saleLongitude = 0;
    private double saleLatitude = 0;
    private String rightYear;
    private String decorationStandard;
    private String propertyCost;
    private String propertyCompany;
    @Type(type = "com.nervenets.web.adapter.jsonType.BuildingAlbumArrayJson")
    @Column(columnDefinition = "text")
    private List<BuildingAlbum> albums = new ArrayList<>();
    private int disable;
    @Column(columnDefinition = "tinyint")
    private CheckStatus checkStatus = CheckStatus.checking;
    private String remark;
    private boolean onSale;
    @ManyToOne
    @JoinColumn(name = "manager_id")
    private Manager manager;

    public Building(String name, Manager manager) {
        this.name = name;
        this.manager = manager;
    }
}
